// run: $exec < input
// opt: 0
// flag: -g
#include <iostream>

int a[200];
long long l, r;

long long calc(long long x)
{
	long long tx = x;
	int len = 0;
	for (; tx; tx /= 2) a[len++] = tx & 1;
	long long ret = (len - 2) * (len - 1) / 2;
	int c = 0, i = len - 1;
	for (; i >= 0; i--)
		if (!a[i]) break;
		else c++;
	ret += c - 1;
	bool ok = true;
	if (i < 0) ok = false;
	for (i--; i >= 0; i--)
		if (!a[i]) { ok = false; break; }
	return ret + ok;
}

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin >> l >> r;
//	for (int i = 1; i <= 10; i++) std::cout << "i = " << i << "   " << calc(i) << "\n";
	std::cout << calc(r) - calc(l - 1) << "\n";
}

